Hydrocarbon production from rock formations can include multiple stages of oil recovery. The first stage of hydrocarbon production, also referred to as primary recovery, involves utilizing natural reservoir energy to drive hydrocarbons from the reservoir, into the wellbore, and up to the surface. The primary recovery stage can reach its end when the available energy in the reservoir is depleted. During primary recovery, typically only around 10% of the initial hydrocarbons in the reservoir is recovered. The second stage of hydrocarbon production, also referred to as secondary recovery, involves injecting an external fluid such as water or gas into the reservoir through injection wells in order to maintain reservoir pressure and displace hydrocarbons toward the wellbore. Common secondary recovery methods include gas injection and waterflooding. The secondary recovery stage can reach its end when the injected fluid is produced in considerable amounts from the production wells. During secondary recovery, additional hydrocarbons can be recovered from the reservoir. The third stage of hydrocarbon production, also referred to as tertiary recovery or enhanced oil recovery, involves any recovery method that follows secondary recovery, such as waterflooding or pressure maintenance. During tertiary recovery, additional hydrocarbons can be recovered from the reservoir.